<?php

/**
 * product actions.
 *
 * @package    fkshop
 * @subpackage product
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class productActions extends sfActions
{
  public function executeIndex(sfWebRequest $request)
  {
  	
  	 $this->categories = Doctrine_Core::getTable('Category')->getWithProducts();
//     $this->products = Doctrine_Core::getTable('Product')->getProducts();
 //    $this->randomProducts = Doctrine_Core::getTable('Product')->getProductByRandom();
  }

  public function executeShow(sfWebRequest $request)
  {
    $this->product = $this->getRoute()->getObject();
  }

  public function executeSearch(sfWebRequest $request){
  	$this->keywords = $request->getParameter('keywords');
  	$this->results = Doctrine_Core::getTable('Product')->getProductsByName($this->keywords);
  	
  }
  
  public function executeRandomProducts(sfWebRequest $request){
  	
  }
  
  
/*
  protected function processForm(sfWebRequest $request, sfForm $form)
  {
    $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
    if ($form->isValid())
    {
      $product = $form->save();

      $this->redirect('product/edit?id='.$product->getId());
    }
  }
  */
}
